package com.ws.entity;

/**
 * @author 王硕
 * @version jdk21
 * @className HourlyEmployee
 * @description
 * @date 2024/11/7 21:56
 */

public class HourlyEmployee extends Employee {
    private double hourlyWage;
    private int hoursWorked;

    public HourlyEmployee(String name, int birthdayMonth, double hourlyWage, int hoursWorked) {
        super(name, birthdayMonth);
        this.hourlyWage = hourlyWage;
        this.hoursWorked = hoursWorked;
    }
@Override
    public double getSalary(int month) {
        double baseSalary = super.getSalary(month);
        if (hoursWorked <= 160) {
            baseSalary += hourlyWage * hoursWorked;
        } else {
            baseSalary += hourlyWage * 160 + hourlyWage * 1.5 * (hoursWorked - 160);
        }
        return baseSalary;
    }

    public double getHourlyWage() {
        return hourlyWage;
    }

    public int getHoursWorked() {
        return hoursWorked;
    }
}